Method of detecting objects

ABSTRACT

A method of recognizing and detecting colors is disclosed, to allow recognition and sorting of objects. Pixels of a color image of an object to be recognized are received, the hue, intensity and/or saturation of each pixel is determined, the hue, intensity and/or saturation of each received pixel is allocated to a plurality of predetermined hue, intensity and/or saturation bands respectively to obtain hue, intensity and/or saturation distribution values respectively for the color image, and the distribution values for the color image are compared with the distribution values from one or more reference objects to determine if the object is recognized as a said reference object. This method of object recognition is independent of the image complexity and the number of colors on the object to be recognized. The method operates to compare a hue signature of the object to be recognized with a hue signature of a reference object.

This application is a 35 U.S.C. §371 filing of International PatentApplication No. PCT/GB99/00980 filed Mar. 29, 1999. This applicationclaims priority benefit of Great Britain Patent Application No.9810771.7, filed May 19, 1998.

This invention relates to a method of detecting colours, andparticularly, but not exclusively, to such a method for detecting andsubsequently sorting differently coloured gaming chips.

Sorting systems for sorting articles as they move along a conveyor beltare well known. Typically, such systems have been employed to sort andreject fruit and vegetables by their colour (indicative of ripeness), tosort bottles for recycling by glass or plastic colour, and to sortgaming chips in casinos, different chips being differently coloured.

One known technique for sorting by colour uses a spectral analysis ofthe article. For example, a camera is employed to obtain an image of thearticle, which is then digitized and spectrum analysed.

Several techniques have been proposed to improve the sorting speed andreduce the number of incorrectly identified articles. For example, thesystem described in U.S. Pat. No. 4,278,538 detects spectral intensitythrough a three element sensor. U.S. Pat. No. 4,488,245 shows a systemfor detecting colour by defining a volume in red-green-blue (RGB)colourspace with RGB intensity values on the three axes x, y and z. Theinterrelation of the colour elements is used to separate articles. Asimilar system is employed in U.S. Pat. No. 5,058,325, and a thresholdanalysis of an RGB histogram is carried out.

U.S. Pat. No. 5,432,545 shows an apparatus for sorting coloured bottles.An image of each bottle is obtained in Red-Green-Blue format and is thenconverted into Hue-Saturation-Intensity format. A histogram of the huesin the image is formed and a peak in the histogram is determined. Thevalue of the peak is compared with reference values to determine thecolour of each bottle.

U.S. Pat. No. 5,339,963 shows an apparatus for sorting fruit. As well asusing the peak hue in the hue histogram, a composite hue value is alsoobtained. Each value is compared with a corresponding preset value toobtain a decision on whether a match is, or is not, present.

Finally, JP-A-8-229516 and JP-A-7-253359 each show an apparatus forsorting coloured bottles. An image in Hue-Saturation-Intensity format isobtained and the hue is divided into a plurality of hue bands. Adecision on colour matching is based upon a comparison of the magnitudeof a plurality of the hue bands with preset threshold values.

Although the prior art described above is suitable for discriminatingsingly coloured objects (such as green or brown bottles), severedifficulties arise when there is an array of colours in the objects tobe sorted. For example, articles to be sorted can often become dirtywhich will affect their “colour” as detected by a video camera. Articlessuch as bottles and gaming chips can also fade over time necessitatingthe introduction of lower present threshold values for detection in theprior art techniques. Even more importantly, none of the prior arttechniques is able to handle multi-coloured articles satisfactorily.Bottles with large labels, heavily variegated fruit or gaming chipshaving multi-coloured pictures thereon are all difficult or impossibleto sort accurately with the foregoing techniques.

It is therefore an object of the present invention to provide animproved colour detection apparatus.

According to a first aspect of the present invention, an objectrecognition method and apparatus is provided in which pixels of a colourimage on an object to be recognised are received, the hue, intensityand/or saturation of each pixel is determined, the hue, intensity and/orsaturation of each received pixel is allocated to a plurality ofpredetermined hue, intensity and/or saturation bands respectively toobtain hue, intensity and/or saturation distribution values respectivelyfor the colour image, and the distribution values for the colour imageare compared with the distribution values from one or more referenceobjects to determine if the object is recognised as a said referenceobject.

This method of object recognition is independent of the image complexityand the number of colours on the object to be recognised. The methodoperates to compare a hue signature of the object to be recognized witha hue signature of a reference object. Thus the colour pattern of anobject can be matched with the colour pattern of a reference object.

The method is also independent of object orientation. The method isparticularly advantageous when identifying objects such as items offruit or coloured bottles, as the hue of such objects is notsignificantly affected by dirt or grease thereon. This is to becontrasted with the use of R,G,B colour space, where each of the valuesR, G and B will change as the object becomes dirty.

Because the method relies upon comparing numbers for a plurality, suchas 360, hue bands, the position of each pixel is irrelevant. Thus, thecomparison may be carried out relatively swiftly. Moreover, because acorrelation technique is employed as opposed to a threshold comparison,the actual number of pixels allocated to each hue hand is irrelevant. Itis the shape of the histogram rather than its height which is matched toa preset “colour signature” to obtain a probability of colour match.

In accordance with the present invention, any method of comparing thedistribution values for the colour image with the distribution valuesfor one or more reference objects can be used. Such techniques would beapparent to a skilled person in the art. For example, the distributionvalues can be considered to form an n-dimensional feature vector where nis the number of bands and the comparison can be achieved by featurevector matching techniques, e.g. by measuring the Euclidean distancebetween the vectors. The object can then be recognised as a referenceobject depending upon the distance between the feature vectors for thereference object and the object to be recognised.

According to an aspect of the present invention, there is provided amethod of object recognition by colour, comprising receiving, as aplurality of object pixels, a colour object image of an object to berecognised, allocating the object pixels into a plurality ofpredetermined hue bands, and comparing the numbers of object pixels ineach said hue band with corresponding numbers for reference pixelsrepresenting a reference object, to generate a hue correlationrepresentative of the probability that the object to be recognisedmatches the reference object.

It is to be understood that the term “correlation” refers generally tothe extent that the reference object matches the object to beidentified. The term should therefore not be construed only in thestrict mathematical sense. Furthermore, the term “probability” refersgenerally to a measure of the extent to which the object to berecognised matches the reference object and therefore should not beconstrued only in a strict mathematical sense.

Preferably, the method further comprises allocating the object pixelsinto a plurality of predetermined pseudo saturation bands, and comparingthe numbers of object pixels in each said pseudo saturation band withcorresponding numbers for reference pixels representing the referenceobject, to generate a pseudo saturation correlation representative ofthe probability that the object to be recognised matches the referenceobject.

Although the recognition of an object to be sorted can be carried outsimply on the basis of pixel hue, using the pseudo saturation of thepixels as well can assist in object identification. This is particularlythe case when the object to be recognised contains a large quantity ofwhite, black or grey colours.

Strictly, the term “saturation” refers to the purity of a hue, that is,the freedom from white. Saturation according to this definition isreferred to throughout the specification and claims as “truesaturation”. However, true saturation is dimensionless, and white, blackand grey scales all have a true saturation of zero. Also, truesaturation does not vary with brightness. Therefore, in the followingdescription and claims, the term “pseudo saturation” is also employed.Pseudo saturation is a measure of true saturation, but with acontribution from intensity. In the present case, pseudo saturationtakes into account the true saturation as well as the magnitude ofwhite. Mathematically, pseudo saturation is defined as n−min (R,G,B),where min (R,G,B) is the amount of white (on a scale of 0 to n) in acolour having a particular hue. Typically, n ranges between 0 and 255.

For example, in R,G,B colour space, the colour pink is represented as(255, 100, 100) which is made up of fully saturated red (255, 0, 0)together with white (100, 100, 100). Thus, for pink, min (R,G,B) is 100.

Preferably, the pseudo saturation and hue correlations are combined, toprovide an overall matching correlation. In particular, a weightedaverage may be employed. Weighting the average towards the huecorrelation improves the ability to recognise correctly such objects asitems of fruit, casino chips or coloured bottles, for example, when theyare dirty.

In an alternative embodiment, the true saturation of each pixel may beallocated to one of a plurality of true saturation bands for bothreference and object images.

Whether true or pseudo saturation correlations are generated, the pixelsmay also be allocated to one of a plurality of intensity bands for bothreference and object images. Intensity correlation can thus also beobtained.

Preferably, the method further comprises comparing, for each of afurther plurality of reference objects, the numbers of reference pixelsin each said hue band with the corresponding numbers for the objectpixels, to generate a further plurality of hue correlationsrepresentative of the probability that the object to be recognisedmatches each of said further reference objects, and determining which ofthe reference objects has the closest hue correlation with the object tobe recognized.

Thus, it is possible to discriminate between a plurality of referenceobjects and decide which reference object provides the closest match,based upon a comparison of the number of object pixels in the varioushue bands with the number of reference image pixels in each hue band foreach reference image. Again, comparison of pseudo saturation bands or,alternatively, comparison of true saturation bands, and intensity bands,can be employed as well, to improve discrimination. Furthermore, athreshold correlation may be generated, the object being recognised ifthe closest hue or pseudo saturation correlations are larger than thesaid threshold correlation, or being rejected as unrecognised if smallerthan the said threshold correlation. After discrimination, the objectmay be sorted into one of a plurality of groups of recognised objects,or sorted into a group of unrecognised objects.

According to a further aspect of the present invention, there isprovided a method of object recognition by colour comprising receiving,as a plurality of object pixels, a colour object image of an object tobe recognised, allocating the object pixels into a plurality ofpredetermined pseudo saturation bands, and comparing the numbers ofobject pixels in each said pseudo saturation band with correspondingnumbers for reference pixels representing a reference object, togenerate a pseudo saturation correlation representative of theprobability that the object to be recognised matches the referenceobject.

In yet a further aspect of the invention, there is provided a method ofobject recognition by colour comprising receiving, as a plurality ofobject pixels, a colour object image of an object to be recognised,allocating the object pixels into a plurality of predetermined intensitybands, and comparing the numbers of object pixels in each said intensityband with corresponding numbers for reference pixels representing areference object, to generate an intensity correlation representative ofthe probability that the object to be recognised matches the referenceobject.

The invention also extends to an apparatus for recognising objects whichemploys such methods. The apparatus preferably comprises means forreceiving the plurality of object pixels and the or each plurality ofreference pixels, memory means for storing the numbers of the referencepixels in the plurality of hue bands, a first comparator for comparingthe numbers of object pixels in each said hue band with thecorresponding numbers for the reference pixels, and means for outputtingin dependence upon the or each hue correlation. The memory means mayalso store the numbers of the reference pixels in the plurality ofpseudo saturation bands. In this case, the apparatus may furthercomprise a second comparator for comparing the numbers of object pixelsin each said pseudo saturation band with the corresponding numbers forthe reference pixels.

The invention may also be put into practice using software. Thus, theinvention extends to a storage medium for storing instructions tocontrol a processor to carry out the above methods.

According to yet a further aspect of the present invention, there isprovided a method for sorting gaming chips according to their colour,comprising receiving, as a plurality of object pixels, a colour objectimage of a gaming chip to be sorted, allocating the object pixels into aplurality of predetermined hue bands, and comparing the numbers ofobject pixels in each said hue band with corresponding numbers for aplurality of groups of reference pixels representing a plurality ofdifferently coloured reference gaming chips, to generate a plurality ofhue correlations representative of the probabilities that the gamingchip to be recognised matches each reference gaming chip, anddetermining which of the reference gaming chips has the closest huecorrelation with the gaming chip to be recognised.

This method preferably further comprises allocating the object pixelsinto a plurality of predetermined pseudo saturation bands, comparing thenumbers of object pixels in each said pseudo saturation band withcorresponding numbers for the plurality of groups of reference pixelsrepresenting the plurality of differently coloured reference gamingchips, to generate a plurality of pseudo saturation correlationsrepresentative of the probabilities that the gaming chip to berecognised matches each reference gaming chip, and determining which ofthe reference gaming chips has the closest pseudo saturation correlationwith the gaming chip to be recognised.

It is to be understood that, in fact, advantages are obtained byemploying hue histogram comparisons, true saturation histogramcomparisons, intensity histogram comparisons or pseudo saturationhistogram comparisons, either alone or in any combination. Further, anapparatus operating according to any of these comparisons, again eitheralone of in any combination, is advantageous.

One example of the invention will now be explained with reference to theaccompanying drawings, in which:

FIG. 1 shows an overview of a sorting apparatus for sorting gamingchips;

FIGS. 2 a to 2 d show exemplary histograms of the hue and saturation ofsuch gaming chips; and

FIGS. 3 a, 3 b and 3 c show, schematically, one technique for comparingsuch histograms.

It will be understood that this description is for the purposes ofillustration only, and that the details of the hardware used toimplement the preferred method of detecting colours will, in general,vary depending upon the object to be detected. Indeed, the invention maybe put into practice using software.

The apparatus shown in FIG. 1 sorts gaming chips in a casino. As is wellknown, such chips are typically circular and have a diameter of about 4cm. The chips are differently coloured to represent different playersaround a table in a casino. Furthermore, the casino may use “valuechips”, which have a direct monetary value and tend to have a moreelaborate range of colours and designs. During use by visitors to thecasino, the differently coloured chips become mixed together, and it isa labourious task to separate such chips into stacks of differentcolours/values manually. Thus, colour recognition systems have beendeveloped which detect the colour of individual chips and sorts themaccordingly. An early chip sorting machine is described in GB 1,571,219and GB 1,571,220. Four photo diodes are employed, with four filters(red, green, blue and yellow). A halogen lamp is used to illuminatechips as they pass below the photodiodes. An individual point on thechip is measured by the photodiodes whose electronic response iscompared to a stored electronic photodiode response from a referencechip.

An improvement to such a method is shown in WO 96/34258. Here, thenumber of photodiodes is expanded to a 64 diode linear array with adiffraction grating to generate a rudimentary frequency spectrum.

Finally, GB 2,254,419 describes a different system for sorting chips.This device employs a charge coupled device to derive a digital image ofthe chips to be sorted.

There are several difficulties in sorting chips by colour. Firstly, theknown algorithms for colour detection and discrimination have difficultyhandling black, white or grey scale chips, for reasons which will beexplained below. Secondly, and more importantly, known colourrecognition systems have difficulty handling multi-coloured chips, suchas “value” chips which typically comprise a single colour around thecircumference of the chip, with a complex, multi-coloured pattern in thecentre of the chip, (such as a casino's logo or a photograph). Thedifficulty in recognising the chips arises predominantly from the(usually random) orientation of the chip relative to the colourrecognition system. The colour recognition system sees a differentcoloured chip, depending upon the orientation of that chip relative tothe detectors.

The other problem which affects known chip sorting apparatus is thatchips become dirty over a period of time. Such chips, are oftenincorrectly sorted in the chip sorting system of the prior art, such asthose described above.

FIG. 1 shows schematic diagram of a chip sorting system 10, employing apreferred embodiment of the colour recognition method of the presentinvention. The system 10 includes a hopper 20 having an entrance funnel30, into which chips to be sorted are placed.

A conveyor belt 40 passes through the hopper 20. The conveyor belt 40contains a plurality of cups 50, mounted upon the surface of the belt40. As the belt 40 moves through the hopper 20, so chips in the hopperare scooped up into the cups 50 thereon.

In order for the contents of each cup to be recognisable, it isnaturally important that each cup 50 contains only one chip. Thus, thepart of the belt 40 which passes through the hopper 20 is arranged on anincline, as shown in FIG. 1. The cups are so shaped and sized that, iftwo chips are scooped up by any given cup 50, the upper one will rollout and backwards down the slope.

As well as two chips sometimes initially being scooped up into one cup,some cups (such as the one marked 50′ in FIG. 1) may fail entirely tocapture a chip. The colour recognition technique is able to is recognisewhen cups are empty.

Mounted above the conveyor belt, downstream from the hopper 20, is avideo camera 60. The lens of the video camera 60 is pointed towards thecups 50 on the belt 40. A xenon stroboscope 70, associated with thevideo camera 60, illuminates the cups 50 on the belt 40. The camera 60is arranged generally perpendicular to the belt 40. However, thestroboscope 70 is mounted at approximately 45° to the belt 40, to avoiddirect reflections.

The stroboscope 70 is synchronized to the velocity of the belt 40, suchthat the resulting image obtained by the camera 60 from the moving beltappears stationary (that is, in the same position every time an image isacquired). Although the stroboscope and belt are synchronized, thecamera 60 runs asynchronously to the belt 40. Thus, the precise timingof the stroboscope 70 may be delayed by several video lines if the cupto be imaged is in position when the camera is in between consecutivefield exposures. This small delay is negligible in terms of freezing themotion in the same position each time. Gas discharge of xenon isconveniently used to provide the light source for the stroboscope 70.This is because xenon has a relatively broad spectrum and this in turnpermits hues throughout the majority of the visible spectrum to beidentified.

Each image obtained by the video camera 60 is captured by a video framegrabber 80 which digitizes the video image. To reduce processing timefor this image, a target area within the whole image frame is extracted.In the present example, this is a circle representative of the gamingchip. Of course, for other applications, other shaped target areas maybe employed.

The extracted target area image is sent to a processor 90. The processor90 converts the target area image into hue, saturation and intensity(HSI) format for further analysis. For rapid conversion to HSI format,it is preferable that the camera image is provided from the framegrabber 80 in luminance and chrominance (YC_(b)C_(r))format. This isbecause conversion from YC_(b)C_(r) format to HSI format may be doneusing a lookup table to implement the required arctan mathematicalfunction. Although red-green-blue (RGB) format video data could besupplied to the frame grabber instead, this would increase theprocessing time of the processor 90.

The processor uses the HSI information, in a manner to be describedbelow, to identify the chip according to its colour signature. Once thechip has been identified, the processor 90 sends a signal to a pluralityof solenoids 100. Each solenoid is in engagement with a cam (not shown),located beneath the surface of the belt 40. The solenoids aresynchronized with the motion of the belt and the cam operates aplurality of spring ejector pins 110 which in turn move upwards, intocontact with the cups 50, when the respective solenoid 100 receives asignal from the processor 90. As the pin 110 moves upwards, it lifts thechip in its associated cup 50.

Associated with each of the solenoids 100 is a corresponding chipcollector 120. Each of the chip collector 120 has a lip adjacent to thebelt 40. Thus, as one of the solenoids 100 moves its corresponding pin110 upwards, the raised chip is captured by the lip of the correspondingchip catcher 120, which captures the chosen chip and places it in one ofa plurality of chip stacks. Each stack generally contains chips of onecolour scheme, or one predetermined group of colour schemes, only.However, one of the stacks is generally employed to collect rejectchips, that is, chips whose colour cannot be adequately matched to thatof any of the reference chips.

The manner in which the processor controls the solenoids 100 to sort thechips does not form part of the present invention, and will not bedescribed in further detail.

The algorithm employed in the processor 90, to identify the chips bytheir colour, will now be explained in more detail.

HSI is the preferred colour space, in this example, as the hue contentof chips tends to remain relatively constant as such chips become‘faded’ with age, or become dirty. Furthermore, the hue content of chipsis not altered significantly by the intensity of illumination by thestroboscope 70.

On the other hand, both true and pseudo saturation, and intensity, areaffected by dirt and stroboscope intensity. However, pseudo saturationand intensity information in particular is useful to distinguish betweenwhite, black and greyscale chips (or, alternatively, pseudo saturationcan be used).

By convention, white, black and greyscale chips are each mapped to afixed hue angle.

Before chip sorting can begin, the processor must first learn the coloursignatures of each of the differently coloured chips to be sorted. To dothis, the machine is switched into “programme mode”. A number ofdifferently coloured chips, to be used as reference chips, are placedinto the hopper 20. Once the machine enters “programme” mode, it firstobtains an image of an empty cup 50.

It is important that the camera be properly is focussed upon the cups,and that the focus remains relatively constant. Otherwise, for example,individual red or green dots in the image may be seen as monochromaticyellow.

The video frame grabber 80 captures the image, converts it to a seriesof pixels and passes it to the processor 90 in a manner previouslydescribed. If necessary, the plurality of pixels are converted fromYC_(b)C_(r) format to HSI format. During conversion, very low intensitypixels are mapped to a fixed hue angle to avoid introduction of noiseerrors to the hue data. Next, histograms of hue and pseudo saturationare constructed within the processor 90.

The dynamic range of each pixel is 9 bits (0 to 511) for hue,representative of 0 to 359 degrees of hue. For example, the wholevisible spectrum is divided into 360 hues, with 0° representing red,120° representing green, and 240° representing blue. Each pixel willalso have a dynamic range of 8 bits (0 to 255) for true saturation andintensity. As explained above, the dynamic range of pseudo saturation isalso 0 to 255 and 8 bits are thus employed. 32 bit integers are used forthe histogram values.

In the preferred embodiment, two histograms are generated, onecomprising hue (0 to 359°) versus number of pixels having a given hue,and one comprising pseudo saturation (0 to 255) versus number of pixelshaving a given amount of pseudo saturation. Thus, the empty cup providestwo signature histograms.

These two histograms are stored in separate addresses within a volatilememory in the processor 90. The histograms may also be output to anon-volatile storage device such as a floppy disk. External storage ofthe histograms allows the apparatus to be powered off and on againwithout having to reprogramme it. Meanwhile, a first reference chip, ina cup on the moving belt, moves into a location under the camera, and afirst reference image is obtained. First reference hue, and pseudosaturation histograms are obtained as with the empty cup histograms, andstored at further addresses in the memory of the processor 90.

The belt 40 continues to move past the camera 60 and the sequence ofevents is repeated until all the different coloured chips have beenimaged, and their histograms stored. As each reference chip's coloursignature is obtained, its hue and pseudo saturation histograms arecompared with those of the empty cup to ensure that duplicate empty cuphistograms are not stored.

Each reference chip will have its own unique reference histograms,regardless of the complexity of the colours upon each chip. For example,a blue chip with a detailed multicoloured pattern will have a morecomplex hue histogram, in particular, than a plain blue chip which has asingle main peak in the hue histogram. FIGS. 2 a and 2 b show typicalhue and saturation reference histograms for a gaming chip having a largerange of colours, respectively. FIGS. 2 c and 2 d, on the other hand,show typical hue and saturation reference histograms for a simplercoloured chip.

Following collection of the reference histograms, the “programme mode”is exited, and the chips to be sorted are placed into the, hopper 20,where they are ejected into the cups 50 on the moving belt 40. As eachcup passes beneath the camera 60, images of the cup either empty orcontaining a chip are taken as explained in relation to FIG. 1.

The image of a particular cup is converted to a series of pixels andalso into HSI format if necessary. Hue and pseudo saturation histogramsof the cup are then constructed.

The measured hue histogram is compared with each of the reference huehistograms. Independently, the measured pseudo saturation histogram iscompared with the stored reference pseudo saturation histograms. This isagain carried out by the processor 90.

One preferred technique for comparing the histograms is simply tosubtract each reference histogram from each measured histogram, and thensum the absolute values of the difference. Generally:$V = {\sum\limits_{n = 0}^{N}\quad{{H_{n} - R_{n}}}}$where N is the number of degrees of freedom within the histogram, H_(n)is the number of pixels having a hue n within the measured image, andR_(n) is the number of pixels having a hue n within a given referenceimage. Generally, for example, if each pixel hue is allocated to one of360 hues, then N=359.

The value V calculated this way is, however, only meaningful whenH_(n)=R_(n) for all N, whence V=0. This indicates an exact match.

S Usually, a 100% match is not achieved. There are many reasons forthis. Most commonly, the reason is that the intensity of the stroboscope70 is not constant. Other factors include the variations in chip colourdue to manufacturing tolerances, or dirt on the chip, and electronicnoise within the imaging system. Thus, a percentage correlation Z(0%<Z,<100%)is calculated.

V is scaled to give a percentage between 0% and 100% by defining a zeropercent matching chip colour as a histogram of random pixel hues orpseudo saturations having the same number of pixels as the measuredimage. Such a histogram may be approximated, for a large number ofpixels, as a horizontal line. Mathematically,$Z^{\prime} = {\sum\limits_{n = 0}^{N}\quad{{H_{n} - A}}}$and$A = {\frac{1}{N}\lbrack {\sum\limits_{n = 0}^{N}R_{n}} \rbrack}$This may be linearly interpolated to calculate Z, where Z=100% when V=0,and Z=0% when V=Z′ or less.

If only coloured chips are to be sorted, then typically a matchpercentage may be adequately obtained from the hue histograms only.However, it is often the case that chips contain amounts of white, blackor greys, or indeed the chips may be either wholly black or whollywhite. A hue histogram alone cannot distinguish between chips that aresolely white, black or varying shades of grey, as each of these ismapped to the same hue value (although at different intensities) uponconversion to HSI format.

Thus, to avoid erroneous matching of, say black chips with white chips,a combination of the hue matching percentage and the pseudo saturationmatching percentage is calculated. Again depending upon processor speed,many ways of combining the two matching percentages may be used. Themost straightforward is $M_{1} = ( \frac{H \times S}{100} )$where H is the hue matching percentage and S is the pseudo saturationmatching percentage. Hence, a measured chip that is wholly white incolour would have H=100% and S=0% when compared with a black referencechip.

The overall match M₁, may then be linearized as follows$M_{2} = {100 - \lbrack \frac{( {100 - M_{1}} )^{2}}{100} \rbrack}$Finally, the match M₂ is weighted. This is to assist in the sorting ofdirty chips.$M_{3} = \lbrack \frac{{15H} + {5 \cdot S} + {80 \cdot M_{2}}}{100} \rbrack$

Any chip to be sorted is compared against the reference chip histogramsand allocated to one of the chip collectors 120.

It may be necessary to allocate the threshold match percentagedynamically, depending upon the similarity in colour signatures betweenthe various reference chips. For example, if four of the reference chipscontain a predominance of the same particular hue, then the matchbetween a chip to be sorted and these four reference chips may be 70%,40%, 60% and 90% respectively. In order to ensure that the chip iscorrectly sorted, it is then necessary to set a relatively highthreshold (In the above example, setting a threshold of >71% would allowa correct match). Conversely, if the reference chips each have verydifferent hues, then a lower threshold is required, as one of thereference chips will have a much higher match with the chip to be sortedthan the others. For example, with matches of 10%, 10%, 90% and 20%, thethreshold need be set only at 21% to ensure a correct match. In otherwords, each of the reference hue and pseudo saturation histograms‘competes’ for the best match with the corresponding measuredhistograms.

If the correlations obtained between the chip to be sorted and each ofthe reference chips are all below the threshold correlation, then thechip is passed to the reject stack.

The confidence of match between a reference chip and a chip to be sortedwill reduce as the latter becomes dirty, for example. Thus it may beuseful to allocate the threshold match dynamically during each chipsorting operation. Thus, when the system identifies that the chip to besorted is dirty, the threshold match is reduced accordingly so that thisdirty chip is not rejected.

Empty cups 50 on the belt 40 are detected by matching the image of sucha cup with the reference ‘empty cup’ image.

Operating in accordance with the method described above, approximately550 chips per minute may be sorted. Nonetheless, several improvements tothe above algorithm are possible, depending upon the speed of theprocessor 90. It will be understood that the processor to be chosen is atrade-off between cost, on the one hand, and speed, on the other. Ofcourse slower processors can be utilized, but this requires the belt 40to move more slowly and this in turn slows down the chip sorting speed.

The description above has employed only two histograms, one of which isa true hue histogram and one of which is a pseudo saturation histogram.Depending upon processor speed, however, it may be preferable to usetrue saturation values to generate a true saturation histogram. In orderto recognize monochrome chips, however, the intensity values of thepixels may be employed as well, such that, for the image of each chip tobe sorted, three histograms are generated, one for hue, one for truesaturation and one for intensity. As all three such histograms must becompared with a corresponding three histograms for each reference chip,the processing time is consequently increased.

A second improvement is to normalise the pseudo saturation histograms.Typically, both pseudo saturation and intensity histograms will vary inlocation on the ‘X’ axis (see FIG. 2), due to variations in intensity ofthe stroboscope 70 (the stroboscope intensity variation may be as muchas 5% between flashes). The stroboscope intensity variation also appearsas random noise on the hue histogram.

To address the variations in the pseudo saturation histograms, part ofthe image field that is presented to the camera 60 has a referencepseudo saturation. This may be, for example, at the edge of each cup 50,and the reference pseudo saturation is preferably a light greyscale(which, of course, has a constant hue and relatively low pseudosaturation). Each image captured (both reference image and measuredimage) has its pseudo saturation shifted using the reference saturationin part of the image. It is more efficient to shift the pseudosaturation histogram, once obtained, than to attempt to scale the rawimage data prior to histogram generation.

An alternative method of dealing with the problems of X-axis shift inthe pseudo saturation and intensity histograms, caused by the variationin stroboscopic intensity, employs sliding correlation. The technique isshown schematically in FIGS. 3 a to 3 c.

In these figures, the pseudo saturation histogram of a reference chip isindicated in solid line at B, and that of an object chip to be sorted isindicated in broken line at A. The location of the reference histogramalong the X axis is kept constant, whilst the location of the objectchip histogram is moved along the X-axis. Once the object histogram hasbeen obtained, the histogram is first shifted 20 pseudo saturationvalues to the left, for example, as shown in FIG. 3 a. The referencehistogram is then subtracted from the object histogram, in the mannerset out above, to obtain a first percentage match.

Next, each of the pseudo saturation values in the object histogram isincreased by one, and the reference histogram (which has thus beenshifted to the right as seen in the Figures) is again subtracted fromthe object histogram to obtain a second percentage match. The processcontinues until the object histogram has been moved 20 pseudo saturationvalues to the right of its initial position (FIG. 3 c). Thus, the objecthistogram is ‘slid’ across the stationary reference histogram, and amaximum match percentage is ascertained. The distance (along the X-axis)over which the object histogram is slid usually needs to be constrained(in the above example it is +/−20 pseudo saturation values), to avoid anaccidental match with a completely different reference pseudo saturationhistogram.

This sliding correlation technique can also be used to maximise thematch percentage on the hue histograms. Certain cameras, particularlycheaper ones, have instabilities in the colour balance. This has theeffect of moving the hue histograms back and forth along the hue axis.By using the sliding correlation technique, the match percentage erroris reduced.

Finally, it is possible to pre-process the histograms with a digitalfilter, such as a first order low-pass filter, to improve the histogrammatching.

Whilst a preferred embodiment has been described in terms of hardware,it will be understood that the algorithm may equally be put intopractice using software controlling a personal computer, for example.

Furthermore, although a gaming chip sorter has been described, it willbe appreciated that other applications of the colour recognitionalgorithm are envisaged. For example, a motion detector can be readilyconstructed for use with a colour video security system. Any change atall in stored hue and saturation histograms (which are derived from animage of the room or other space when empty) can indicate an intruder'spresence. Such a technique can even be extended to infra-red cameras,the hue angle being defined across the infra-red part of theelectromagnetic spectrum. This would allow the alarm to operate in thedark.

Similarly, fire or smoke will generate a change in colour and hence inhue and saturation, and thus the algorithm described above may be usedin a fire or smoke detector having video imaging.

The colour detection system also permits detection of televisionadverts, when these are preceded by a distinctive logo on screen. Byoverwriting such a logo on programmes deemed unsuitable for children,the detection system may detect and automatically cut off suchprogrammes. The weather may be detected using this technique as well;blue sky, rain and atmospheric air quality all have unique coloursignatures.

Sorting of other objects is also envisaged. Fruit may be sorted byripeness, ripe fruit having a different colour signature to unripefruit. In this case, because the fruit is three dimensional, it ispreferable to employ two or more cameras at different angles to theconveyor belt along which the fruit passes. This allows the fruit to beimaged from more than one direction to improve the confidence ofmatching. Coloured bottles can also be sorted in this way. Paperproduction can be monitored, as can wood quality and print quality on aprinting press.

Finally, by employing aerial photography, environmental analysis offorests can be carried out, as well as automatic ripeners indications ofwheat/grain fields. Higher distance aerial photographs can permit rapidquantitative analysis of urban development versus “green areas”.

1. A method of object recognition by colour comprising: receiving, as aplurality of object pixels, a colour object image of the object to berecognised; allocating the object pixels to a plurality of predeterminedhue bands; allocating the object pixels to at least one of a pluralityof intensity bands, a plurality of saturation bands, and a plurality ofpseudo saturation bands; characterised by: comparing the numbers ofobject pixels in each said hue band with corresponding numbers forreference pixels representing a reference object to generate a huecorrelation; comparing the numbers of object pixels in each saidintensity, saturation and/or pseudo saturation band with correspondingnumbers for reference pixels representing a reference object to generatea respective intensity, saturation and/or pseudo saturation correlation;and combining said generated correlations to generate a combinedcorrelation representative of the probability that the object to berecognised matches the reference object.
 2. The method as claimed inclaim 1, wherein said combined correlation is generated by averagingsaid generated correlations.
 3. The method as claimed in claim 2,wherein said combined correlation is generated by taking a weightedaverage of said generated correlations.
 4. The method as claimed inclaim 1, wherein said predetermined hue bands are predetermined bydividing all of the visible spectrum into 360 separate hue bands.
 5. Themethod as claimed in claim 1, wherein said comparing steps are repeatedfor each of a plurality of reference objects to generate a respectiveplurality of hue and intensity, saturation and/or pseudo saturationcorrelations and said combining step is repeated for each of saidplurality of reference objects to generate a respective combinedcorrelation; the method including recognising the object by determiningwhich of said reference objects has the closest combined correlationwith the object.
 6. The method as claimed in claim 5, wherein saidobject is recognised as a said reference object when said combinedcorrelation is larger than a threshold correlation.
 7. The method asclaimed in claim 6, wherein said object is rejected as not beingrecognised as a said reference object when said combined correlation issmaller than said threshold.
 8. The method as claimed in claim 1,further comprising: employing sliding correlation between the numbers ofobject pixels in each said intensity, saturation and/or pseudosaturation band and the corresponding numbers for the said referencepixels representing the reference object to generate the respectiveintensity, saturation and/or pseudo saturation correlation.
 9. Themethod of sorting objects comprising the method of object recognition bycolour as claimed in claim 1 for recognising objects; and furthercomprising: sorting objects according to the result of the recognition.10. A method of sorting objects according to their colour, comprising:receiving, as a plurality of object pixels, a colour object image ofeach of a plurality of reference objects of different colours;allocating the object pixels into a plurality of predetermined hue bandsand at least one of a plurality of predetermined intensity bands,saturation bands and pseudo saturation bands to generate a reference huedistribution and a respective reference intensity, saturation and/orpseudo saturation distribution for each said reference object; receivingas a plurality of object pixels, a colour object image of each of aplurality of objects to be recognised; allocating the object pixels tosaid plurality of predetermined hue bands and at least one of saidplurality of predetermined intensity bands, saturation bands and pseudosaturation bands; characterised by: comparing the number of objectpixels in each said hue band for the objects to be recognised with thenumber of object pixels in each said hue band for the reference objectsto generate a respective hue correlation for each object to berecognised with respect to each reference object; comparing the numberof object pixels in each said intensity, saturation and/or pseudosaturation band for the objects to be recognised with the number ofobject pixels in each respective said intensity, saturation and/orpseudo saturation band for the reference objects to generate arespective intensity, saturation and/or pseudo saturation correlationfor each object to be recognised with respect to each reference object;combining said generated correlations for each object to be recognisedwith respect to each reference object to generate combined correlationsrepresentative of the probability that the objects to be recognisedmatch the reference objects; and sorting said objects to be recognisedin accordance with the probability that the objects match the referenceobjects.
 11. The method as claimed in claim 10, wherein each combinedcorrelation is generated by averaging the relevant generatedcorrelations for each object to be recognised with respect to eachreference object.
 12. The method as claimed in claim 11, wherein eachcombined correlation is generated by taking a weighted average of therelevant generated correlations.
 13. The method as claimed in claim 10,wherein said predetermined hue bands are predetermined by dividing allof the visible spectrum into 360 separate hue bands.
 14. The method asclaimed in claim 10 wherein a particular one of said objects to berecognised is recognised as a particular one of said reference objectswhen the relevant combined correlation is larger than a thresholdcorrelation.
 15. The method as claimed in claim 14, wherein a particularone of said objects to be recognised is rejected as not being recognisedas a particular one of said reference objects when the relevant combinedcorrelation is smaller than said threshold.
 16. The method as claimed inclaim 10 further characterised by: employing sliding correlation betweenthe numbers of object pixels in each said intensity, saturation and/orpseudo saturation band and the corresponding numbers for the saidreference pixels representing any one of said reference objects togenerate the respective intensity, saturation and/or pseudo saturationcorrelation.
 17. An apparatus for object recognition by colour,comprising: a receiving element for receiving, as a plurality of objectpixels, a colour object image of an object to be recognised; a firstallocating element for allocating the object pixels to a plurality ofpredetermined hue bands; a second allocating element for allocating theobject pixels to at least one of a plurality of intensity bands, aplurality of saturation bands, and a plurality of pseudo saturationbands; a first comparing element for comparing the numbers of objectpixels in each said hue band with corresponding numbers for referencepixels representing a reference object to generate a hue correlation; asecond comparing element for comparing the numbers of object pixels ineach said intensity, saturation and/or pseudo saturation band withcorresponding numbers for reference pixels representing a referenceobject to generate a respective intensity, saturation and/or pseudosaturation correlation; and a combining element for combining saidgenerated correlations to generate a combined correlation representativeof the probability that the object to be recognised matches thereference object.
 18. The apparatus as claimed in claim 17, wherein saidcombining element is adapted to generate said combined correlation byaveraging said generated correlations.
 19. The apparatus as claimed inclaim 17, wherein said combining element is adapted to generate saidcombined correlation by taking a weighted average of said generatedcorrelations.
 20. The apparatus as claimed in claim 17 including anelement for predetermining said predetermined hue bands by dividing allof the visible spectrum into 360 separate hue bands.
 21. The apparatusas claimed in claim 17 wherein said first and second comparing elementsare adapted to repeat the comparison for each of a plurality ofreference objects to generate a respective plurality of hue andintensity, saturation and/or pseudo saturation correlations, and saidcombining element is adapted to repeat the combining for each of saidplurality of reference objects to generate a respective combinedcorrelation; the apparatus including an element for recognising theobjects by determining which of said reference objects has the closestcombined correlation with the object.
 22. The apparatus as claimed inclaim 21, wherein said recognising element is adapted to recognise saidobject as a said reference object when said combined correlation islarger than a threshold correlation.
 23. The apparatus as claimed inclaim 22, wherein said recognising element is adapted to reject saidobject as not being recognised as a said reference object when saidcombined correlation is smaller than said threshold.
 24. An apparatusfor sorting objects according to their colour, the apparatus comprising:a receiving element for receiving, as a plurality of object pixels, acolour object image of each of a plurality of reference objects ofdifferent colours; a first allocating element for allocating the objectpixels into a plurality of predetermined hue bands and at least one of aplurality of predetermined intensity bands, saturation bands and pseudosaturation bands, to generate a reference hue distribution and arespective reference intensity, saturation and/or pseudo saturationdistribution for each said reference object; means for receiving, as aplurality of object pixels, a colour object image of each of a pluralityof objects to be recognised; second allocating means for allocating theobject pixels to said plurality of predetermined hue bands and at leastone of said plurality of predetermined intensity bands, saturation bandsand pseudo saturation bands; characterised by: a first comparing elementfor comparing the number of object pixels in each said hue band for theobjects to be recognised with the number of object pixels in each saidhue hand for the reference objects to generate a respective huecorrelation for each object to be recognised with respect to eachreference object; a second comparing element for comparing the number ofobject pixels in each said intensity, saturation and/or pseudosaturation band for the objects to be recognised with the number ofobject pixels in each respective said intensity, saturation and/orpseudo saturation band for the reference objects to generate arespective intensity, saturation and/or pseudo saturation correlationfor each object to be recognised with respect to each reference object;a combining element for combining said generated correlations for eachobject to be recognised with respect to each reference object togenerate combined correlations representative of the probability thatthe objects to be recognised match the reference objects; and a sortingelement for sorting said objects to be recognised in accordance with theprobability that the objects match the reference objects.
 25. Theapparatus as claimed in claim 24, wherein said combining means isadapted to generate each combined correlation for each object to berecognised with respect to each reference object by averaging therelevant generated correlations for each object to be recognised withrespect to each reference object.
 26. The apparatus as claimed in claim25, wherein said combining means is adapted to generate each combinedcorrelation by taking a weighted average of the relevant generatedcorrelations.
 27. The apparatus as claimed in claim 24, including meansfor predetermining said predetermined hue bands by dividing all of thevisible spectrum into 360 separate hue bands.
 28. The apparatus asclaimed in claim 24, wherein said recognising means is adapted torecognise a particular one of said objects to be recognised as aparticular one of said reference objects when the relevant combinedcorrelation is larger than a threshold correlation.
 29. The apparatus asclaimed in claim 28, wherein said recognising means is adapted to rejecta particular one of said objects to be recognised as not beingrecognised as a particular reference object when said combinedcorrelation is smaller than said threshold.
 30. A carrier mediumcarrying computer code for object recognition by colour, the computercode comprising instructions for: receiving, as a plurality of objectpixels, a colour object image of the object to be recognised; allocatingthe object pixels to a plurality of predetermined hue bands; allocatingthe object pixels to at least one of a plurality of intensity bands, aplurality of saturation bands, and a plurality of pseudo saturationbands; characterised by: comparing the numbers of object pixels in eachsaid hue band with corresponding numbers for reference pixelsrepresenting a reference object to generate a hue correlation; comparingthe numbers of object pixels in each said intensity, saturation and/orpseudo saturation band with corresponding numbers for reference pixelsrepresenting a reference object to generate a respective intensity,saturation and/or pseudo saturation correlation; and combining saidgenerated correlations to generate a combined correlation representativeof the probability that the object to be recognised matches thereference object.